import { Controller, Get, Post, Body } from '@nestjs/common';
import { CatService } from './cat.service';
import { ApiOperation } from '@nestjs/swagger';
import { JwtNoVerify } from '../../decorators';
import { CatDto, CatUpdateDto } from './dto/cat.dto';

@Controller('cat')
export class CatController {
  constructor(private readonly _catService: CatService) {}

  @Post('add-cat')
  @JwtNoVerify()
  @ApiOperation({ summary: '添加猫猫数据' })
  async create(@Body() cat: CatDto) {
    return await this._catService.create(cat);
  }

  @Get('cat-list')
  @JwtNoVerify()
  @ApiOperation({ summary: '获取所有猫猫数据' })
  async findAll() {
    return await this._catService.findAll();
  }

  @Post('update-cat')
  @JwtNoVerify()
  @ApiOperation({ summary: '更新猫猫数据' })
  async update(@Body() cat: CatUpdateDto) {
    return await this._catService.update(cat);
  }
}
